Go to QuArK Web Site
Introduction to the source
Updated 02 Mar 2001
Upper levels:
QuArK Information Base
4. The Source Code

 4.3. Introduction to the source

 [ Prev - Up - Next ] 

 Index


 Delphi for C(++) programmers

Tiglari - 02 Mar 2001   [ Top ] 

Delphi is an system built on Object Pascal. The difference between O.P. and C++ is mostly syntax, but there are some substantive matters:

  • case doesn't matter: string = String
  • @variable gives the address of variable.
  • The OP class system is based on RTTI, and has inherently greater flexibility than C++ (tho a lot less that Python). See e.g. Armin's remarks in source\prog\QObjects.txt
  • Casts are done with what looks like a C++ constructor. so if you want to cast a QObject as QFileObject, you write:  QFileObject(Obj)  where Obj is your QObject.
  • OP constructors are by convention called Create, but can be called anything. So MyClass.Create('bozo') would probably be a constructor.
  • A significant innovation is `properties' (basically the same thing as `ties' in PERL). A property is a class attribute that looks like an ordinary data member externally, but has associated with it  read  and  write  methods that are invoked at the appropriate times. So something like:  thing.size := 10;  can set off an arbitrarily large amount of processing, if  size  is a property of  thing 's class. Convenient for coding, but sometimes deceptive when reading the results ...
  • HORRIBLE GOTCHA: in an  if begin ... end else ...  statmement, if you put a semicolon after end, it will compile but the else block will never execute. [Note by Armin: wrong, a ';' before an 'else' will never compile] The semicolon rules are different than in C(++). Semicolons suck.
  • OP doesn't use header files. The essential work of C(++) .h files is done in the  interface  section of a module, whereas the work of the .c(pp) files is done in the following  implementation  section. It wouldn't be a bad a idea to read the delphi help on  interface ,  implementation  and  initialization .
  • programs, modules, etc end with  end.  This also sucks.
  • In spite of the semicolons, in general, as far as I can make out, O.P. has everything you need to make real programs, without the annoying limitiations of 'textbook Pascal'.


 Delphi Per Se

Tiglari - 02 Mar 2001   [ Top ] 

The basic idea of delphi is 'components'. These are modules that are installed into the IDE (by a command like Component|Install), where they appear as icons on as 'component palette'. Installed components can be clicked on and dropped into forms, or they can be invoked 'texturally' just by naming them in the declarings of a module.

There are squillions of components available on the internet, free, share & commercial. It seems to work well (about as smooth as PERL modules, modulo the advantages of the visual IDE).

As delphi versions increment, the IDE gets more sophisticated, but if you start with delphi v2 (occasionally available for free from various sources), the shift to v5 (current) is not daunting. I think I like it better than Borland C++ 4 or DevStudio 5.


 French-to-English lexicon

Tiglari / Armin - 02 Mar 2001   [ Top ] 


Aucun       - none

Ajouter     - to add



Charger     - to load



Dans        - in (SuivantDansGroupe = following in group)

Deplacer    - to move



Enfant      - child

Enregistrer - to save

Entete      - header

Etat        - state (TEtatObjet = object state type)



Fichier     - file

Frere       - brother (ModifeFrere = brother modified)



Lien        - link (LienFichierQObject = File Link QObject)

Lire        - to read



Modifier    - to modify



Ouvrir      - to open



Retirer     - to remove



SousElement - sub-element (Sous = under)

SousSelVide - empty sub-selection

Suivant     - following (SuivantDansGroupe = following in group)

SurDisque   - on-disk (Sur = on, over)



Tout, Toute - all

Taille      - size



Vide        - empty



GNU General Public License by The QuArK (Quake Army Knife) Community - http://www.planetquake.com/quark

 [ Prev - Top - Next ]